import datetime

from base import HTMLTestRunnerNew
import unittest
import time

from base.excel import Do_Excel
from base.tools import get_path

excel = Do_Excel(f"{get_path()}/report/report.xlsx", 'Sheet1')
excel.write_excel(l=1, h=2, val=f"{str(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))}")  # 记录开始执行时间

discover = unittest.defaultTestLoader.discover(f"{get_path()}/case", "test_*.py")
with open(f"{get_path()}/report/report{time.strftime('%Y%m%d-%H-%M-%S')}.html", 'wb+') as file:
    runner = HTMLTestRunnerNew.HTMLTestRunner(stream=file,
                                              title="数据分发内测环境ui回归测试用例",
                                              description="数据分发版本1.5.0",
                                              tester="小王")
    runner.run(discover)
excel.write_excel(l=2, h=2, val=f"{str(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))}")  # 记录结束执行时间
excel.write_excel(l=3, h=2, val="回归完成")  # 记录结束执行时间

# 控制环境的话去
